<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitepage
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: Controller.php 2011-05-05 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
class Sitepage_Widget_SponsoredSitepageController extends Engine_Content_Widget_Abstract {

  public function indexAction() {

		//GET SPONSERED PAGES
    $totalSitepage = Engine_Api::_()->sitepage()->getLising('Total Sponsored Sitepage');
    $sitepage_sponcerd = Zend_Registry::isRegistered('sitepage_sponcerd') ? Zend_Registry::get('sitepage_sponcerd') : null;

		//NO RENDER IF SPONSERED PAGES ARE ZERO
    $this->view->totalCount = $totalSitepage->count();
    if (!($this->view->totalCount > 0)) {
      return $this->setNoRender();
    }

		//SEND PAGE DATA TO TPL
    $this->view->sitepages = $sitepages = Engine_Api::_()->sitepage()->getLising('Sponsored Sitepage');

    $this->view->count = $sitepages->count();
    if (empty($sitepage_sponcerd)) {
      return $this->setNoRender();
    }
  }
}

?>